package com.gopay.common.cps.dao.bank.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.bank.BisBizProdSpBankDAO;
import com.gopay.common.domain.bis.BisBizProdSpBankConfig;
/**
 * 
 * @BisBizProdSpBankDAOImpl.java
 * @author mz
 * @Jan 7, 2014 6:44:45 PM  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("bisBizProdSpBankDAO")
public class BisBizProdSpBankDAOImpl extends BaseDAOImpl<BisBizProdSpBankConfig, Serializable> implements BisBizProdSpBankDAO {

	@Override
	public BisBizProdSpBankConfig getBisBizProdSpBank(String bankCode,
			String bankProdCode) {
		 Map<String,Object> params = new HashMap<String,Object>();
	        params.put("bankCode", bankCode);
	        params.put("bankBizProdCode", bankProdCode);
			List<BisBizProdSpBankConfig> l = super.findByHql("from BisBizProdSpBankConfig where bankCode=:bankCode and bankBizProdCode =:bankBizProdCode ", params);
	        return l.size() > 0 ? l.get(0) : null;
	}

	@Override
	public List<BisBizProdSpBankConfig> getBisBizProdSpBankByBankCode(
			String bankCode) {
		Map<String,Object> params = new HashMap<String,Object>();
	    params.put("bankCode", bankCode);
	    return super.findByHql("from BisBizProdSpBankConfig where bankCode=:bankCode and enable=1 ", params);
	}
	
	
	@Override
	public List<BisBizProdSpBankConfig> getBisBizProdSpBankByBankCodeWithoutStatus(
			String bankCode) {
		Map<String,Object> params = new HashMap<String,Object>();
	    params.put("bankCode", bankCode);
	    return super.findByHql("from BisBizProdSpBankConfig where bankCode=:bankCode", params);
	}

	@Override
	public List<BisBizProdSpBankConfig> getBisBizProdSpBankByProdCode(
			String prodCode) {
		Map<String,Object> params = new HashMap<String,Object>();
	    params.put("prodCode", prodCode);
	    return super.findByHql("from BisBizProdSpBankConfig where bankBizProdCode=:prodCode and enable=1 ", params);
	}

    @Override
    public List<BisBizProdSpBankConfig> getAllBisBizProdSpBankByProdCode(String prodCode) {
        Map<String,Object> params = new HashMap<String,Object>();
        params.put("prodCode", prodCode);
        return super.findByHql("from BisBizProdSpBankConfig where bankBizProdCode=:prodCode", params);
    }
	
}
